package com.xidian.zhiancloud.controller.systemset;

import com.xidian.zhiancloud.controller.base.BaseController;
import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.service.user.SysHomeRiskDisplaySettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 首页风险显示设置
 */
@RestController
@RequestMapping("/homeriskdisset")
public class SysHomeRiskDisplaySettingsController extends BaseController {

    @Autowired
    SysHomeRiskDisplaySettingsService homeRiskDisplaySettingsService;

    /**
     * 查询返回列表
     * @return 返回ResultDTO对象
     */
    @RequestMapping("/selecthomeRiskDisplaySettingsList")
    public ResultDTO selecthomeRiskDisplaySettingsList() {
        return ResultDTO.successOf(homeRiskDisplaySettingsService
           .selecthomeRiskDisplaySettingsList(this.getSessionUserCompanyId()),
                GeneralResponseEnums.SUCCESS);
    }

    /**
     * 添加/编辑
     * @param id 首页风险显示设置ID
     * @param homeCorporateRisk 首页企业综合风险
     * @param homeCorporateRiskChangeTrend 首页企业综合风险变化趋势
     * @return 返回ResultDTO对象
     */
    @RequestMapping("/updatehomeRiskDisplaySettings")
    public ResultDTO updatehomeRiskDisplaySettings
       (@RequestParam(value = "id",required = false,defaultValue = "0")
                String id,
       @RequestParam("homeCorporateRisk") Integer homeCorporateRisk,
       @RequestParam("homeCorporateRiskChangeTrend")
                 Integer homeCorporateRiskChangeTrend) {
        Long companyId = this.getSessionUserCompanyId();
        return ResultDTO.successOf(homeRiskDisplaySettingsService.updatehomeRiskDisplaySettings(companyId,id,homeCorporateRisk,homeCorporateRiskChangeTrend),GeneralResponseEnums.SUCCESS);
    }


}


